package logic

import (
	"context"
	"weekly1/user-server/protot/user"
	"weekly1/user-service/server"
)

type UserServer struct {
	user.UnimplementedUserServer
}

func (u UserServer) UserRegister(ctx context.Context, in *user.UserRegisterReq) (*user.UserRegisterResp, error) {
	register, err := server.UserRegister(in)
	if err != nil {
		return nil, err
	}
	return register, nil
}

func (u UserServer) UserLogin(ctx context.Context, in *user.UserLoginReq) (*user.UserLoginResp, error) {
	login, err := server.UserLogin(in)
	if err != nil {
		return nil, err
	}
	return login, nil
}

func (u UserServer) VideoList(ctx context.Context, in *user.VideoListReq) (*user.VideoListResp, error) {
	list, err := server.VideoList(in)
	if err != nil {
		return nil, err
	}
	return list, nil
}

func (u UserServer) VideoAdd(ctx context.Context, in *user.VideoAddReq) (*user.VideoAddResp, error) {
	add, err := server.VideoAdd(in)
	if err != nil {
		return nil, err
	}
	return add, nil
}
